﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace EFDemo.Migrations
{
    /// <inheritdoc />
    public partial class updateCol : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_WaferMaps_RecipeId",
                table: "WaferMaps");

            migrationBuilder.AddColumn<long>(
                name: "RecipeTestId",
                table: "Recipes",
                type: "INTEGER",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_WaferMaps_RecipeId",
                table: "WaferMaps",
                column: "RecipeId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_Recipes_RecipeTestId",
                table: "Recipes",
                column: "RecipeTestId");

            migrationBuilder.AddForeignKey(
                name: "FK_Recipes_RecipeTests_RecipeTestId",
                table: "Recipes",
                column: "RecipeTestId",
                principalTable: "RecipeTests",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Recipes_RecipeTests_RecipeTestId",
                table: "Recipes");

            migrationBuilder.DropIndex(
                name: "IX_WaferMaps_RecipeId",
                table: "WaferMaps");

            migrationBuilder.DropIndex(
                name: "IX_Recipes_RecipeTestId",
                table: "Recipes");

            migrationBuilder.DropColumn(
                name: "RecipeTestId",
                table: "Recipes");

            migrationBuilder.CreateIndex(
                name: "IX_WaferMaps_RecipeId",
                table: "WaferMaps",
                column: "RecipeId");
        }
    }
}
